package com.xsystem.util;

import org.apache.log4j.helpers.FormattingInfo;
import org.apache.log4j.helpers.PatternConverter;
import org.apache.log4j.spi.LoggingEvent;

public class ThreadIdConverter extends PatternConverter {

	private StringBuilder buf = new StringBuilder(5);

	public ThreadIdConverter() {
		super();
	}

	public ThreadIdConverter(FormattingInfo formattingInfo) {
		super(formattingInfo);
	}

	@Override
	public String convert(LoggingEvent event) {
		buf.setLength(0);
		buf.append(Thread.currentThread().getId());

		return buf.toString();
	}
}
